/*
 * Copyright (C) 2016 Allwinnertech
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Adjustable factor-based clock implementation
 */

#include "clk-sun8iw12.h"

/*
 * freq table from hardware, need follow rules
 * 1)   each table  named as
 *      factor_pll1_tbl
 *      factor_pll2_tbl
 *      ...
 * 2) for each table line
 *      a) follow the format PLLx(n, k, m, p, d1, d2, freq), and keep the
 *         factors order
 *      b) if any factor not used, skip it
 *      c) the factor is the value to write registers, not means factor + 1
 *
 *      example
 *      PLL1(9, 0, 0, 2, 60000000) means PLL1(n, k, m, p, freq)
 *      PLLVIDEO0(3, 0, 96000000) means PLLVIDEO0(n, m, freq)
 *
 */

/* PLLCPU(n, m, p, freq)	F_N8X8_M0X2_P16x2 */
struct sunxi_clk_factor_freq factor_pllcpu_tbl[] = {
PLLCPU(11,     0,     2,     72000000U),
PLLCPU(12,     0,     2,     78000000U),
PLLCPU(13,     0,     2,     84000000U),
PLLCPU(14,     0,     2,     90000000U),
PLLCPU(15,     0,     2,     95000000U),
PLLCPU(16,     0,     2,     102000000U),
PLLCPU(17,     0,     2,     108000000U),
PLLCPU(18,     0,     2,     114000000U),
PLLCPU(19,     0,     2,     120000000U),
PLLCPU(20,     0,     2,     126000000U),
PLLCPU(21,     0,     2,     132000000U),
PLLCPU(22,     0,     2,     138000000U),
PLLCPU(23,     0,     2,     144000000U),
PLLCPU(24,     0,     2,     150000000U),
PLLCPU(12,     0,     1,     156000000U),
PLLCPU(13,     0,     1,     168000000U),
PLLCPU(14,     0,     1,     180000000U),
PLLCPU(15,     0,     1,     192000000U),
PLLCPU(16,     0,     1,     204000000U),
PLLCPU(17,     0,     1,     216000000U),
PLLCPU(18,     0,     1,     228000000U),
PLLCPU(19,     0,     1,     240000000U),
PLLCPU(20,     0,     1,     252000000U),
PLLCPU(21,     0,     1,     264000000U),
PLLCPU(22,     0,     1,     276000000U),
PLLCPU(23,     0,     1,     288000000U),
PLLCPU(24,     0,     1,     300000000U),
PLLCPU(25,     0,     1,     312000000U),
PLLCPU(26,     0,     1,     324000000U),
PLLCPU(27,     0,     1,     336000000U),
PLLCPU(28,     0,     1,     348000000U),
PLLCPU(29,     0,     1,     360000000U),
PLLCPU(30,     0,     1,     372000000U),
PLLCPU(31,     0,     1,     384000000U),
PLLCPU(32,     0,     1,     396000000U),
PLLCPU(33,     0,     1,     408000000U),
PLLCPU(34,     0,     1,     420000000U),
PLLCPU(35,     0,     1,     432000000U),
PLLCPU(36,     0,     1,     444000000U),
PLLCPU(37,     0,     1,     456000000U),
PLLCPU(38,     0,     1,     468000000U),
PLLCPU(39,     0,     1,     480000000U),
PLLCPU(40,     0,     1,     492000000U),
PLLCPU(41,     0,     1,     504000000U),
PLLCPU(42,     0,     1,     516000000U),
PLLCPU(43,     0,     1,     528000000U),
PLLCPU(44,     0,     1,     540000000U),
PLLCPU(45,     0,     1,     552000000U),
PLLCPU(46,     0,     1,     564000000U),
PLLCPU(47,     0,     1,     576000000U),
PLLCPU(48,     0,     1,     588000000U),
PLLCPU(49,     0,     1,     600000000U),
PLLCPU(25,     0,     0,     624000000U),
PLLCPU(26,     0,     0,     648000000U),
PLLCPU(27,     0,     0,     672000000U),
PLLCPU(28,     0,     0,     696000000U),
PLLCPU(29,     0,     0,     720000000U),
PLLCPU(30,     0,     0,     744000000U),
PLLCPU(31,     0,     0,     768000000U),
PLLCPU(32,     0,     0,     792000000U),
PLLCPU(33,     0,     0,     816000000U),
PLLCPU(34,     0,     0,     840000000U),
PLLCPU(35,     0,     0,     864000000U),
PLLCPU(36,     0,     0,     888000000U),
PLLCPU(37,     0,     0,     912000000U),
PLLCPU(38,     0,     0,     936000000U),
PLLCPU(39,     0,     0,     960000000U),
PLLCPU(40,     0,     0,     984000000U),
PLLCPU(41,     0,     0,     1008000000U),
PLLCPU(42,     0,     0,     1032000000U),
PLLCPU(43,     0,     0,     1056000000U),
PLLCPU(44,     0,     0,     1080000000U),
PLLCPU(45,     0,     0,     1104000000U),
PLLCPU(46,     0,     0,     1128000000U),
PLLCPU(47,     0,     0,     1152000000U),
PLLCPU(48,     0,     0,     1176000000U),
PLLCPU(49,     0,     0,     1200000000U),
PLLCPU(50,     0,     0,     1224000000U),
PLLCPU(51,     0,     0,     1248000000U),
PLLCPU(52,     0,     0,     1272000000U),
PLLCPU(53,     0,     0,     1296000000U),
PLLCPU(54,     0,     0,     1320000000U),
PLLCPU(55,     0,     0,     1344000000U),
PLLCPU(56,     0,     0,     1368000000U),
PLLCPU(57,     0,     0,     1392000000U),
PLLCPU(58,     0,     0,     1416000000U),
PLLCPU(59,     0,     0,     1440000000U),
PLLCPU(60,     0,     0,     1464000000U),
PLLCPU(61,     0,     0,     1488000000U),
PLLCPU(62,     0,     0,     1512000000U),
PLLCPU(63,     0,     0,     1536000000U),
PLLCPU(64,     0,     0,     1560000000U),
PLLCPU(65,     0,     0,     1584000000U),
PLLCPU(66,     0,     0,     1608000000U),
PLLCPU(67,     0,     0,     1632000000U),
PLLCPU(68,     0,     0,     1656000000U),
PLLCPU(69,     0,     0,     1680000000U),
PLLCPU(70,     0,     0,     1704000000U),
PLLCPU(71,     0,     0,     1728000000U),
PLLCPU(72,     0,     0,     1752000000U),
PLLCPU(73,     0,     0,     1776000000U),
PLLCPU(74,     0,     0,     1800000000U),
PLLCPU(75,     0,     0,     1824000000U),
PLLCPU(76,     0,     0,     1848000000U),
PLLCPU(77,     0,     0,     1872000000U),
PLLCPU(78,     0,     0,     1896000000U),
PLLCPU(79,     0,     0,     1920000000U),
PLLCPU(80,     0,     0,     1944000000U),
PLLCPU(81,     0,     0,     1968000000U),
PLLCPU(82,     0,     0,     1992000000U),
PLLCPU(83,     0,     0,     2016000000U),
PLLCPU(84,     0,     0,     2040000000U),
PLLCPU(85,     0,     0,     2064000000U),
PLLCPU(86,     0,     0,     2088000000U),
PLLCPU(87,     0,     0,     2112000000U),
PLLCPU(88,     0,     0,     2136000000U),
PLLCPU(89,     0,     0,     2160000000U),
PLLCPU(90,     0,     0,     2184000000U),
PLLCPU(91,     0,     0,     2208000000U),
PLLCPU(92,     0,     0,     2232000000U),
PLLCPU(93,     0,     0,     2256000000U),
PLLCPU(94,     0,     0,     2280000000U),
PLLCPU(95,     0,     0,     2304000000U),
PLLCPU(96,     0,     0,     2328000000U),
PLLCPU(97,     0,     0,     2352000000U),
PLLCPU(98,     0,     0,     2376000000U),
PLLCPU(99,     0,     0,     2400000000U),
PLLCPU(100,     0,     0,     2424000000U),
PLLCPU(101,     0,     0,     2448000000U),
PLLCPU(102,     0,     0,     2472000000U),
PLLCPU(103,     0,     0,     2496000000U),
PLLCPU(104,     0,     0,     2520000000U),
};

/* PLLDDR0(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllddr0_tbl[] = {
PLLDDR0(20,    0,     1,     252000000U),
PLLDDR0(21,    1,     0,     264000000U),
PLLDDR0(24,    0,     1,     300000000U),
PLLDDR0(25,    0,     1,     312000000U),
PLLDDR0(52,    1,     1,     318000000U),
PLLDDR0(53,    1,     1,     324000000U),
PLLDDR0(54,    1,     1,     330000000U),
PLLDDR0(27,    0,     1,     336000000U),
PLLDDR0(56,    1,     1,     342000000U),
PLLDDR0(28,    0,     1,     348000000U),
PLLDDR0(58,    1,     1,     354000000U),
PLLDDR0(29,    0,     1,     360000000U),
PLLDDR0(60,    1,     1,     366000000U),
PLLDDR0(30,    0,     1,     372000000U),
PLLDDR0(62,    1,     1,     378000000U),
PLLDDR0(31,    0,     1,     384000000U),
PLLDDR0(64,    1,     1,     390000000U),
PLLDDR0(32,    0,     1,     396000000U),
PLLDDR0(66,    1,     1,     402000000U),
PLLDDR0(16,    0,     0,     408000000U),
PLLDDR0(68,    1,     1,     414000000U),
PLLDDR0(34,    0,     1,     420000000U),
PLLDDR0(70,    1,     1,     426000000U),
PLLDDR0(17,    0,     0,     432000000U),
PLLDDR0(72,    1,     1,     438000000U),
PLLDDR0(36,    0,     1,     444000000U),
PLLDDR0(74,    1,     1,     450000000U),
PLLDDR0(18,    0,     0,     456000000U),
PLLDDR0(76,    1,     1,     462000000U),
PLLDDR0(38,    0,     1,     468000000U),
PLLDDR0(78,    1,     1,     474000000U),
PLLDDR0(19,    0,     0,     480000000U),
PLLDDR0(80,    1,     1,     486000000U),
PLLDDR0(40,    0,     1,     492000000U),
PLLDDR0(82,    1,     1,     498000000U),
PLLDDR0(20,    0,     0,     504000000U),
PLLDDR0(84,    1,     1,     510000000U),
PLLDDR0(42,    0,     1,     516000000U),
PLLDDR0(86,    1,     1,     522000000U),
PLLDDR0(21,    0,     0,     528000000U),
PLLDDR0(88,    1,     1,     534000000U),
PLLDDR0(44,    0,     1,     540000000U),
PLLDDR0(90,    1,     1,     546000000U),
PLLDDR0(22,    0,     0,     552000000U),
PLLDDR0(92,    1,     1,     558000000U),
PLLDDR0(46,    0,     1,     564000000U),
PLLDDR0(94,    1,     1,     570000000U),
PLLDDR0(23,    0,     0,     576000000U),
PLLDDR0(96,    1,     1,     582000000U),
PLLDDR0(48,    0,     1,     588000000U),
PLLDDR0(98,    1,     1,     594000000U),
PLLDDR0(24,    0,     0,     600000000U),
PLLDDR0(100,    1,     1,     606000000U),
PLLDDR0(50,    0,     1,     612000000U),
PLLDDR0(102,    1,     1,     618000000U),
PLLDDR0(25,    0,     0,     624000000U),
PLLDDR0(104,    1,     1,     630000000U),
PLLDDR0(52,    0,     1,     636000000U),
PLLDDR0(106,    1,     1,     642000000U),
PLLDDR0(26,    0,     0,     648000000U),
PLLDDR0(108,    1,     1,     654000000U),
PLLDDR0(54,    0,     1,     660000000U),
PLLDDR0(110,    1,     1,     666000000U),
PLLDDR0(27,    0,     0,     672000000U),
PLLDDR0(112,    1,     1,     678000000U),
PLLDDR0(56,    0,     1,     684000000U),
PLLDDR0(114,    1,     1,     690000000U),
PLLDDR0(28,    0,     0,     696000000U),
PLLDDR0(116,    1,     1,     702000000U),
PLLDDR0(58,    0,     1,     708000000U),
PLLDDR0(118,    1,     1,     714000000U),
PLLDDR0(29,    0,     0,     720000000U),
PLLDDR0(120,    1,     1,     726000000U),
PLLDDR0(60,    0,     1,     732000000U),
PLLDDR0(122,    1,     1,     738000000U),
PLLDDR0(30,    0,     0,     744000000U),
PLLDDR0(124,    1,     1,     750000000U),
PLLDDR0(62,    0,     1,     756000000U),
PLLDDR0(126,    1,     1,     762000000U),
PLLDDR0(31,    0,     0,     768000000U),
PLLDDR0(128,    1,     1,     774000000U),
PLLDDR0(64,    0,     1,     780000000U),
PLLDDR0(130,    1,     1,     786000000U),
PLLDDR0(32,    0,     0,     792000000U),
PLLDDR0(132,    1,     1,     798000000U),
PLLDDR0(66,    0,     1,     804000000U),
PLLDDR0(134,    1,     1,     810000000U),
PLLDDR0(33,    0,     0,     816000000U),
PLLDDR0(136,    1,     1,     822000000U),
PLLDDR0(68,    0,     1,     828000000U),
PLLDDR0(138,    1,     1,     834000000U),
PLLDDR0(34,    0,     0,     840000000U),
PLLDDR0(140,    1,     1,     846000000U),
PLLDDR0(70,    0,     1,     852000000U),
PLLDDR0(142,    1,     1,     858000000U),
PLLDDR0(35,    0,     0,     864000000U),
PLLDDR0(144,    1,     1,     870000000U),
PLLDDR0(72,    0,     1,     876000000U),
PLLDDR0(146,    1,     1,     882000000U),
PLLDDR0(36,    0,     0,     888000000U),
PLLDDR0(148,    1,     1,     894000000U),
PLLDDR0(74,    0,     1,     900000000U),
PLLDDR0(150,    1,     1,     906000000U),
PLLDDR0(37,    0,     0,     912000000U),
PLLDDR0(152,    1,     1,     918000000U),
PLLDDR0(76,    0,     1,     924000000U),
PLLDDR0(154,    1,     1,     930000000U),
PLLDDR0(38,    0,     0,     936000000U),
PLLDDR0(156,    1,     1,     942000000U),
PLLDDR0(78,    0,     1,     948000000U),
PLLDDR0(158,    1,     1,     954000000U),
PLLDDR0(39,    0,     0,     960000000U),
PLLDDR0(80,    0,     1,     972000000U),
PLLDDR0(40,    0,     0,     984000000U),
PLLDDR0(82,    0,     1,     996000000U),
PLLDDR0(41,    0,     0,     1008000000U),
PLLDDR0(168,    1,     1,     1014000000U),
PLLDDR0(84,    0,     1,     1020000000U),
PLLDDR0(42,    0,     0,     1032000000U),
PLLDDR0(86,    0,     1,     1044000000U),
PLLDDR0(43,    0,     0,     1056000000U),
PLLDDR0(88,    0,     1,     1068000000U),
PLLDDR0(44,    0,     0,     1080000000U),
PLLDDR0(90,    0,     1,     1092000000U),
PLLDDR0(45,    0,     0,     1104000000U),
PLLDDR0(92,    0,     1,     1116000000U),
PLLDDR0(46,    0,     0,     1128000000U),
PLLDDR0(94,    0,     1,     1140000000U),
PLLDDR0(47,    0,     0,     1152000000U),
PLLDDR0(96,    0,     1,     1164000000U),
PLLDDR0(48,    0,     0,     1176000000U),
PLLDDR0(98,    0,     1,     1188000000U),
PLLDDR0(49,    0,     0,     1200000000U),
};

/* PLLDDR1(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllddr1_tbl[] = {
PLLDDR1(45,     1,     1,     276000000U),
PLLDDR1(47,     1,     1,     288000000U),
PLLDDR1(49,     1,     1,     300000000U),
PLLDDR1(50,     1,     1,     306000000U),
PLLDDR1(25,     0,     1,     312000000U),
PLLDDR1(52,     1,     1,     318000000U),
PLLDDR1(26,     0,     1,     324000000U),
PLLDDR1(54,     1,     1,     330000000U),
PLLDDR1(27,     0,     1,     336000000U),
PLLDDR1(56,     1,     1,     342000000U),
PLLDDR1(28,     0,     1,     348000000U),
PLLDDR1(58,     1,     1,     354000000U),
PLLDDR1(29,     0,     1,     360000000U),
PLLDDR1(60,     1,     1,     366000000U),
PLLDDR1(30,     0,     1,     372000000U),
PLLDDR1(62,     1,     1,     378000000U),
PLLDDR1(15,     0,     0,     384000000U),
PLLDDR1(64,     1,     1,     390000000U),
PLLDDR1(32,     0,     1,     396000000U),
PLLDDR1(66,     1,     1,     402000000U),
PLLDDR1(33,     0,     1,     408000000U),
PLLDDR1(68,     1,     1,     414000000U),
PLLDDR1(34,     0,     1,     420000000U),
PLLDDR1(70,     1,     1,     426000000U),
PLLDDR1(17,     0,     0,     432000000U),
PLLDDR1(72,     1,     1,     438000000U),
PLLDDR1(36,     0,     1,     444000000U),
PLLDDR1(74,     1,     1,     450000000U),
PLLDDR1(18,     0,     0,     456000000U),
PLLDDR1(76,     1,     1,     462000000U),
PLLDDR1(38,     0,     1,     468000000U),
PLLDDR1(78,     1,     1,     474000000U),
PLLDDR1(19,     0,     0,     480000000U),
PLLDDR1(80,     1,     1,     486000000U),
PLLDDR1(40,     0,     1,     492000000U),
PLLDDR1(82,     1,     1,     498000000U),
PLLDDR1(20,     0,     0,     504000000U),
PLLDDR1(84,     1,     1,     510000000U),
PLLDDR1(42,     0,     1,     516000000U),
PLLDDR1(86,     1,     1,     522000000U),
PLLDDR1(21,     0,     0,     528000000U),
PLLDDR1(88,     1,     1,     534000000U),
PLLDDR1(44,     0,     1,     540000000U),
PLLDDR1(90,     1,     1,     546000000U),
PLLDDR1(22,     0,     0,     552000000U),
PLLDDR1(92,     1,     1,     558000000U),
PLLDDR1(46,     0,     1,     564000000U),
PLLDDR1(94,     1,     1,     570000000U),
PLLDDR1(23,     0,     0,     576000000U),
PLLDDR1(96,     1,     1,     582000000U),
PLLDDR1(48,     0,     1,     588000000U),
PLLDDR1(98,     1,     1,     594000000U),
PLLDDR1(24,     0,     0,     600000000U),
PLLDDR1(100,     1,     1,     606000000U),
PLLDDR1(50,     0,     1,     612000000U),
PLLDDR1(102,     1,     1,     618000000U),
PLLDDR1(25,     0,     0,     624000000U),
PLLDDR1(104,     1,     1,     630000000U),
PLLDDR1(52,     0,     1,     636000000U),
PLLDDR1(106,     1,     1,     642000000U),
PLLDDR1(26,     0,     0,     648000000U),
PLLDDR1(108,     1,     1,     654000000U),
PLLDDR1(54,     0,     1,     660000000U),
PLLDDR1(110,     1,     1,     666000000U),
PLLDDR1(27,     0,     0,     672000000U),
PLLDDR1(112,     1,     1,     678000000U),
PLLDDR1(56,     0,     1,     684000000U),
PLLDDR1(114,     1,     1,     690000000U),
PLLDDR1(28,     0,     0,     696000000U),
PLLDDR1(116,     1,     1,     702000000U),
PLLDDR1(58,     0,     1,     708000000U),
PLLDDR1(118,     1,     1,     714000000U),
PLLDDR1(29,     0,     0,     720000000U),
PLLDDR1(120,     1,     1,     726000000U),
PLLDDR1(60,     0,     1,     732000000U),
PLLDDR1(122,     1,     1,     738000000U),
PLLDDR1(30,     0,     0,     744000000U),
PLLDDR1(124,     1,     1,     750000000U),
PLLDDR1(62,     0,     1,     756000000U),
PLLDDR1(126,     1,     1,     762000000U),
PLLDDR1(31,     0,     0,     768000000U),
PLLDDR1(128,     1,     1,     774000000U),
PLLDDR1(64,     0,     1,     780000000U),
PLLDDR1(130,     1,     1,     786000000U),
PLLDDR1(32,     0,     0,     792000000U),
PLLDDR1(132,     1,     1,     798000000U),
PLLDDR1(66,     0,     1,     804000000U),
PLLDDR1(134,     1,     1,     810000000U),
PLLDDR1(33,     0,     0,     816000000U),
PLLDDR1(136,     1,     1,     822000000U),
PLLDDR1(68,     0,     1,     828000000U),
PLLDDR1(138,     1,     1,     834000000U),
PLLDDR1(34,     0,     0,     840000000U),
PLLDDR1(140,     1,     1,     846000000U),
PLLDDR1(70,     0,     1,     852000000U),
PLLDDR1(142,     1,     1,     858000000U),
PLLDDR1(35,     0,     0,     864000000U),
PLLDDR1(144,     1,     1,     870000000U),
PLLDDR1(72,     0,     1,     876000000U),
PLLDDR1(146,     1,     1,     882000000U),
PLLDDR1(36,     0,     0,     888000000U),
PLLDDR1(148,     1,     1,     894000000U),
PLLDDR1(74,     0,     1,     900000000U),
PLLDDR1(150,     1,     1,     906000000U),
PLLDDR1(37,     0,     0,     912000000U),
PLLDDR1(152,     1,     1,     918000000U),
PLLDDR1(76,     0,     1,     924000000U),
PLLDDR1(154,     1,     1,     930000000U),
PLLDDR1(38,     0,     0,     936000000U),
PLLDDR1(156,     1,     1,     942000000U),
PLLDDR1(78,     0,     1,     948000000U),
PLLDDR1(158,     1,     1,     954000000U),
PLLDDR1(39,     0,     0,     960000000U),
PLLDDR1(160,     1,     1,     966000000U),
PLLDDR1(80,     0,     1,     972000000U),
PLLDDR1(162,     1,     1,     978000000U),
PLLDDR1(40,     0,     0,     984000000U),
PLLDDR1(82,     0,     1,     996000000U),
PLLDDR1(41,     0,     0,     1008000000U),
PLLDDR1(84,     0,     1,     1020000000U),
PLLDDR1(42,     0,     0,     1032000000U),
PLLDDR1(86,     0,     1,     1044000000U),
PLLDDR1(43,     0,     0,     1056000000U),
PLLDDR1(88,     0,     1,     1068000000U),
PLLDDR1(44,     0,     0,     1080000000U),
PLLDDR1(90,     0,     1,     1092000000U),
PLLDDR1(45,     0,     0,     1104000000U),
PLLDDR1(92,     0,     1,     1116000000U),
PLLDDR1(46,     0,     0,     1128000000U),
PLLDDR1(94,     0,     1,     1140000000U),
PLLDDR1(47,     0,     0,     1152000000U),
PLLDDR1(96,     0,     1,     1164000000U),
PLLDDR1(48,     0,     0,     1176000000U),
PLLDDR1(98,     0,     1,     1188000000U),
PLLDDR1(49,     0,     0,     1200000000U),
};

/* PLLPERIPH0(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllperiph0_tbl[] = {
PLLPERIPH0(24,     0,     1,     150000000U),
PLLPERIPH0(26,     0,     1,     162000000U),
PLLPERIPH0(28,     0,     1,     174000000U),
PLLPERIPH0(30,     0,     1,     186000000U),
PLLPERIPH0(32,     0,     1,     198000000U),
PLLPERIPH0(34,     0,     1,     210000000U),
PLLPERIPH0(36,     0,     1,     222000000U),
PLLPERIPH0(38,     0,     1,     234000000U),
PLLPERIPH0(40,     0,     1,     246000000U),
PLLPERIPH0(42,     0,     1,     258000000U),
PLLPERIPH0(44,     0,     1,     270000000U),
PLLPERIPH0(46,     0,     1,     282000000U),
PLLPERIPH0(48,     0,     1,     294000000U),
PLLPERIPH0(50,     0,     1,     306000000U),
PLLPERIPH0(52,     0,     1,     318000000U),
PLLPERIPH0(54,     0,     1,     330000000U),
PLLPERIPH0(56,     0,     1,     342000000U),
PLLPERIPH0(58,     0,     1,     354000000U),
PLLPERIPH0(60,     0,     1,     366000000U),
PLLPERIPH0(62,     0,     1,     378000000U),
PLLPERIPH0(64,     0,     1,     390000000U),
PLLPERIPH0(66,     0,     1,     402000000U),
PLLPERIPH0(134,     1,     1,     405000000U),
PLLPERIPH0(138,     1,     1,     417000000U),
PLLPERIPH0(142,     1,     1,     429000000U),
PLLPERIPH0(146,     1,     1,     441000000U),
PLLPERIPH0(150,     1,     1,     453000000U),
PLLPERIPH0(154,     1,     1,     465000000U),
PLLPERIPH0(158,     1,     1,     477000000U),
PLLPERIPH0(162,     1,     1,     489000000U),
PLLPERIPH0(166,     1,     1,     501000000U),
PLLPERIPH0(170,     1,     1,     513000000U),
PLLPERIPH0(174,     1,     1,     525000000U),
PLLPERIPH0(178,     1,     1,     537000000U),
PLLPERIPH0(182,     1,     1,     549000000U),
PLLPERIPH0(186,     1,     1,     561000000U),
PLLPERIPH0(190,     1,     1,     573000000U),
PLLPERIPH0(194,     1,     1,     585000000U),
PLLPERIPH0(198,     1,     1,     597000000U),
PLLPERIPH0(49,     0,     0,     600000000U),
PLLPERIPH0(50,     0,     0,     612000000U),
PLLPERIPH0(51,     0,     0,     624000000U),
PLLPERIPH0(52,     0,     0,     636000000U),
PLLPERIPH0(212,     1,     1,     639000000U),
PLLPERIPH0(106,     0,     1,     642000000U),
PLLPERIPH0(214,     1,     1,     645000000U),
PLLPERIPH0(53,     0,     0,     648000000U),
};

/* PLLPERIPH1(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllperiph1_tbl[] = {
PLLPERIPH1(51,     1,     1,     156000000U),
PLLPERIPH1(26,     0,     1,     162000000U),
PLLPERIPH1(28,     0,     1,     174000000U),
PLLPERIPH1(30,     0,     1,     186000000U),
PLLPERIPH1(32,     0,     1,     198000000U),
PLLPERIPH1(34,     0,     1,     210000000U),
PLLPERIPH1(36,     0,     1,     222000000U),
PLLPERIPH1(38,     0,     1,     234000000U),
PLLPERIPH1(40,     0,     1,     246000000U),
PLLPERIPH1(42,     0,     1,     258000000U),
PLLPERIPH1(44,     0,     1,     270000000U),
PLLPERIPH1(46,     0,     1,     282000000U),
PLLPERIPH1(48,     0,     1,     294000000U),
PLLPERIPH1(50,     0,     1,     306000000U),
PLLPERIPH1(52,     0,     1,     318000000U),
PLLPERIPH1(54,     0,     1,     330000000U),
PLLPERIPH1(56,     0,     1,     342000000U),
PLLPERIPH1(58,     0,     1,     354000000U),
PLLPERIPH1(60,     0,     1,     366000000U),
PLLPERIPH1(62,     0,     1,     378000000U),
PLLPERIPH1(64,     0,     1,     390000000U),
PLLPERIPH1(66,     0,     1,     402000000U),
PLLPERIPH1(68,     0,     1,     414000000U),
PLLPERIPH1(70,     0,     1,     426000000U),
PLLPERIPH1(142,     1,     1,     429000000U),
PLLPERIPH1(146,     1,     1,     441000000U),
PLLPERIPH1(150,     1,     1,     453000000U),
PLLPERIPH1(154,     1,     1,     465000000U),
PLLPERIPH1(158,     1,     1,     477000000U),
PLLPERIPH1(162,     1,     1,     489000000U),
PLLPERIPH1(166,     1,     1,     501000000U),
PLLPERIPH1(170,     1,     1,     513000000U),
PLLPERIPH1(174,     1,     1,     525000000U),
PLLPERIPH1(178,     1,     1,     537000000U),
PLLPERIPH1(182,     1,     1,     549000000U),
PLLPERIPH1(186,     1,     1,     561000000U),
PLLPERIPH1(190,     1,     1,     573000000U),
PLLPERIPH1(194,     1,     1,     585000000U),
PLLPERIPH1(198,     1,     1,     597000000U),
PLLPERIPH1(49,     0,     0,     600000000U),
PLLPERIPH1(50,     0,     0,     612000000U),
PLLPERIPH1(51,     0,     0,     624000000U),
PLLPERIPH1(52,     0,     0,     636000000U),
PLLPERIPH1(53,     0,     0,     648000000U),
};

/* PLLVIDEO0(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllvideo0_tbl[] = {
PLLVIDEO0(11,     0,     72000000U),
PLLVIDEO0(24,     1,     75000000U),
PLLVIDEO0(12,     0,     78000000U),
PLLVIDEO0(26,     1,     81000000U),
PLLVIDEO0(13,     0,     84000000U),
PLLVIDEO0(28,     1,     87000000U),
PLLVIDEO0(14,     0,     90000000U),
PLLVIDEO0(30,     1,     93000000U),
PLLVIDEO0(15,     0,     96000000U),
PLLVIDEO0(32,     1,     99000000U),
PLLVIDEO0(16,     0,     102000000U),
PLLVIDEO0(34,     1,     105000000U),
PLLVIDEO0(17,     0,     108000000U),
PLLVIDEO0(36,     1,     111000000U),
PLLVIDEO0(18,     0,     114000000U),
PLLVIDEO0(38,     1,     117000000U),
PLLVIDEO0(19,     0,     120000000U),
PLLVIDEO0(40,     1,     123000000U),
PLLVIDEO0(20,     0,     126000000U),
PLLVIDEO0(42,     1,     129000000U),
PLLVIDEO0(21,     0,     132000000U),
PLLVIDEO0(44,     1,     135000000U),
PLLVIDEO0(22,     0,     138000000U),
PLLVIDEO0(46,     1,     141000000U),
PLLVIDEO0(23,     0,     144000000U),
PLLVIDEO0(48,     1,     147000000U),
PLLVIDEO0(24,     0,     150000000U),
PLLVIDEO0(50,     1,     153000000U),
PLLVIDEO0(25,     0,     156000000U),
PLLVIDEO0(52,     1,     159000000U),
PLLVIDEO0(26,     0,     162000000U),
PLLVIDEO0(54,     1,     165000000U),
PLLVIDEO0(27,     0,     168000000U),
PLLVIDEO0(56,     1,     171000000U),
PLLVIDEO0(28,     0,     174000000U),
PLLVIDEO0(58,     1,     177000000U),
PLLVIDEO0(29,     0,     180000000U),
PLLVIDEO0(60,     1,     183000000U),
PLLVIDEO0(30,     0,     186000000U),
PLLVIDEO0(62,     1,     189000000U),
PLLVIDEO0(31,     0,     192000000U),
PLLVIDEO0(64,     1,     195000000U),
PLLVIDEO0(32,     0,     198000000U),
PLLVIDEO0(66,     1,     201000000U),
PLLVIDEO0(33,     0,     204000000U),
PLLVIDEO0(68,     1,     207000000U),
PLLVIDEO0(34,     0,     210000000U),
PLLVIDEO0(70,     1,     213000000U),
PLLVIDEO0(35,     0,     216000000U),
PLLVIDEO0(72,     1,     219000000U),
PLLVIDEO0(36,     0,     222000000U),
PLLVIDEO0(74,     1,     225000000U),
PLLVIDEO0(37,     0,     228000000U),
PLLVIDEO0(76,     1,     231000000U),
PLLVIDEO0(38,     0,     234000000U),
PLLVIDEO0(78,     1,     237000000U),
PLLVIDEO0(39,     0,     240000000U),
PLLVIDEO0(80,     1,     243000000U),
PLLVIDEO0(40,     0,     246000000U),
PLLVIDEO0(82,     1,     249000000U),
PLLVIDEO0(41,     0,     252000000U),
PLLVIDEO0(84,     1,     255000000U),
PLLVIDEO0(42,     0,     258000000U),
PLLVIDEO0(86,     1,     261000000U),
PLLVIDEO0(43,     0,     264000000U),
PLLVIDEO0(88,     1,     267000000U),
PLLVIDEO0(44,     0,     270000000U),
PLLVIDEO0(90,     1,     273000000U),
PLLVIDEO0(45,     0,     276000000U),
PLLVIDEO0(92,     1,     279000000U),
PLLVIDEO0(46,     0,     282000000U),
PLLVIDEO0(94,     1,     285000000U),
PLLVIDEO0(47,     0,     288000000U),
PLLVIDEO0(96,     1,     291000000U),
PLLVIDEO0(48,     0,     294000000U),
PLLVIDEO0(98,     1,     297000000U),
PLLVIDEO0(49,     0,     300000000U),
PLLVIDEO0(100,     1,     303000000U),
PLLVIDEO0(50,     0,     306000000U),
PLLVIDEO0(102,     1,     309000000U),
PLLVIDEO0(51,     0,     312000000U),
PLLVIDEO0(104,     1,     315000000U),
PLLVIDEO0(52,     0,     318000000U),
PLLVIDEO0(106,     1,     321000000U),
PLLVIDEO0(53,     0,     324000000U),
PLLVIDEO0(108,     1,     327000000U),
PLLVIDEO0(54,     0,     330000000U),
PLLVIDEO0(110,     1,     333000000U),
PLLVIDEO0(55,     0,     336000000U),
PLLVIDEO0(112,     1,     339000000U),
PLLVIDEO0(56,     0,     342000000U),
PLLVIDEO0(114,     1,     345000000U),
PLLVIDEO0(57,     0,     348000000U),
PLLVIDEO0(116,     1,     351000000U),
PLLVIDEO0(58,     0,     354000000U),
PLLVIDEO0(118,     1,     357000000U),
PLLVIDEO0(59,     0,     360000000U),
PLLVIDEO0(120,     1,     363000000U),
PLLVIDEO0(60,     0,     366000000U),
PLLVIDEO0(122,     1,     369000000U),
PLLVIDEO0(61,     0,     372000000U),
PLLVIDEO0(124,     1,     375000000U),
PLLVIDEO0(62,     0,     378000000U),
PLLVIDEO0(126,     1,     381000000U),
PLLVIDEO0(63,     0,     384000000U),
PLLVIDEO0(128,     1,     387000000U),
PLLVIDEO0(64,     0,     390000000U),
PLLVIDEO0(130,     1,     393000000U),
PLLVIDEO0(65,     0,     396000000U),
PLLVIDEO0(132,     1,     399000000U),
PLLVIDEO0(66,     0,     402000000U),
PLLVIDEO0(134,     1,     405000000U),
PLLVIDEO0(67,     0,     408000000U),
PLLVIDEO0(136,     1,     411000000U),
PLLVIDEO0(68,     0,     414000000U),
PLLVIDEO0(138,     1,     417000000U),
PLLVIDEO0(69,     0,     420000000U),
PLLVIDEO0(140,     1,     423000000U),
PLLVIDEO0(70,     0,     426000000U),
PLLVIDEO0(142,     1,     429000000U),
PLLVIDEO0(71,     0,     432000000U),
PLLVIDEO0(144,     1,     435000000U),
PLLVIDEO0(72,     0,     438000000U),
PLLVIDEO0(146,     1,     441000000U),
PLLVIDEO0(73,     0,     444000000U),
PLLVIDEO0(148,     1,     447000000U),
PLLVIDEO0(74,     0,     450000000U),
PLLVIDEO0(150,     1,     453000000U),
PLLVIDEO0(75,     0,     456000000U),
PLLVIDEO0(152,     1,     459000000U),
PLLVIDEO0(76,     0,     462000000U),
PLLVIDEO0(154,     1,     465000000U),
PLLVIDEO0(77,     0,     468000000U),
PLLVIDEO0(156,     1,     471000000U),
PLLVIDEO0(78,     0,     474000000U),
PLLVIDEO0(158,     1,     477000000U),
PLLVIDEO0(79,     0,     480000000U),
PLLVIDEO0(160,     1,     483000000U),
PLLVIDEO0(80,     0,     486000000U),
PLLVIDEO0(162,     1,     489000000U),
PLLVIDEO0(81,     0,     492000000U),
PLLVIDEO0(164,     1,     495000000U),
PLLVIDEO0(82,     0,     498000000U),
PLLVIDEO0(166,     1,     501000000U),
PLLVIDEO0(83,     0,     504000000U),
PLLVIDEO0(168,     1,     507000000U),
PLLVIDEO0(84,     0,     510000000U),
PLLVIDEO0(170,     1,     513000000U),
PLLVIDEO0(85,     0,     516000000U),
PLLVIDEO0(172,     1,     519000000U),
PLLVIDEO0(86,     0,     522000000U),
PLLVIDEO0(174,     1,     525000000U),
PLLVIDEO0(87,     0,     528000000U),
PLLVIDEO0(176,     1,     531000000U),
PLLVIDEO0(88,     0,     534000000U),
PLLVIDEO0(178,     1,     537000000U),
PLLVIDEO0(89,     0,     540000000U),
PLLVIDEO0(180,     1,     543000000U),
PLLVIDEO0(90,     0,     546000000U),
PLLVIDEO0(182,     1,     549000000U),
PLLVIDEO0(91,     0,     552000000U),
PLLVIDEO0(184,     1,     555000000U),
PLLVIDEO0(92,     0,     558000000U),
PLLVIDEO0(186,     1,     561000000U),
PLLVIDEO0(93,     0,     564000000U),
PLLVIDEO0(188,     1,     567000000U),
PLLVIDEO0(94,     0,     570000000U),
PLLVIDEO0(190,     1,     573000000U),
PLLVIDEO0(95,     0,     576000000U),
PLLVIDEO0(192,     1,     579000000U),
PLLVIDEO0(96,     0,     582000000U),
PLLVIDEO0(194,     1,     585000000U),
PLLVIDEO0(97,     0,     588000000U),
PLLVIDEO0(196,     1,     591000000U),
PLLVIDEO0(98,     0,     594000000U),
};

/* PLLVE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllve_tbl[] = {
PLLVE(50,     1,     1,     306000000U),
PLLVE(26,     0,     1,     324000000U),
PLLVE(54,     1,     1,     330000000U),
PLLVE(27,     0,     1,     336000000U),
PLLVE(28,     0,     1,     348000000U),
PLLVE(58,     1,     1,     354000000U),
PLLVE(29,     0,     1,     360000000U),
PLLVE(60,     1,     1,     366000000U),
PLLVE(30,     0,     1,     372000000U),
PLLVE(62,     1,     1,     378000000U),
PLLVE(31,     0,     1,     384000000U),
PLLVE(64,     1,     1,     390000000U),
PLLVE(32,     0,     1,     396000000U),
PLLVE(66,     1,     1,     402000000U),
PLLVE(16,     0,     0,     408000000U),
PLLVE(68,     1,     1,     414000000U),
PLLVE(34,     0,     1,     420000000U),
PLLVE(70,     1,     1,     426000000U),
PLLVE(17,     0,     0,     432000000U),
PLLVE(72,     1,     1,     438000000U),
PLLVE(36,     0,     1,     444000000U),
PLLVE(74,     1,     1,     450000000U),
PLLVE(18,     0,     0,     456000000U),
PLLVE(76,     1,     1,     462000000U),
PLLVE(38,     0,     1,     468000000U),
PLLVE(78,     1,     1,     474000000U),
PLLVE(19,     0,     0,     480000000U),
PLLVE(80,     1,     1,     486000000U),
PLLVE(40,     0,     1,     492000000U),
PLLVE(82,     1,     1,     498000000U),
PLLVE(20,     0,     0,     504000000U),
PLLVE(84,     1,     1,     510000000U),
PLLVE(42,     0,     1,     516000000U),
PLLVE(86,     1,     1,     522000000U),
PLLVE(21,     0,     0,     528000000U),
PLLVE(88,     1,     1,     534000000U),
PLLVE(44,     0,     1,     540000000U),
PLLVE(90,     1,     1,     546000000U),
PLLVE(22,     0,     0,     552000000U),
PLLVE(92,     1,     1,     558000000U),
PLLVE(46,     0,     1,     564000000U),
PLLVE(94,     1,     1,     570000000U),
PLLVE(23,     0,     0,     576000000U),
PLLVE(96,     1,     1,     582000000U),
PLLVE(48,     0,     1,     588000000U),
PLLVE(98,     1,     1,     594000000U),
PLLVE(24,     0,     0,     600000000U),
PLLVE(100,     1,     1,     606000000U),
PLLVE(50,     0,     1,     612000000U),
PLLVE(102,     1,     1,     618000000U),
PLLVE(25,     0,     0,     624000000U),
PLLVE(104,     1,     1,     630000000U),
PLLVE(52,     0,     1,     636000000U),
PLLVE(106,     1,     1,     642000000U),
PLLVE(26,     0,     0,     648000000U),
PLLVE(108,     1,     1,     654000000U),
PLLVE(54,     0,     1,     660000000U),
PLLVE(110,     1,     1,     666000000U),
PLLVE(27,     0,     0,     672000000U),
PLLVE(112,     1,     1,     678000000U),
PLLVE(56,     0,     1,     684000000U),
PLLVE(114,     1,     1,     690000000U),
PLLVE(28,     0,     0,     696000000U),
PLLVE(116,     1,     1,     702000000U),
PLLVE(58,     0,     1,     708000000U),
PLLVE(118,     1,     1,     714000000U),
PLLVE(29,     0,     0,     720000000U),
PLLVE(120,     1,     1,     726000000U),
PLLVE(60,     0,     1,     732000000U),
PLLVE(122,     1,     1,     738000000U),
PLLVE(30,     0,     0,     744000000U),
PLLVE(124,     1,     1,     750000000U),
PLLVE(62,     0,     1,     756000000U),
PLLVE(126,     1,     1,     762000000U),
PLLVE(31,     0,     0,     768000000U),
PLLVE(128,     1,     1,     774000000U),
PLLVE(64,     0,     1,     780000000U),
PLLVE(130,     1,     1,     786000000U),
PLLVE(32,     0,     0,     792000000U),
PLLVE(132,     1,     1,     798000000U),
PLLVE(66,     0,     1,     804000000U),
PLLVE(134,     1,     1,     810000000U),
PLLVE(33,     0,     0,     816000000U),
PLLVE(136,     1,     1,     822000000U),
PLLVE(68,     0,     1,     828000000U),
PLLVE(138,     1,     1,     834000000U),
PLLVE(34,     0,     0,     840000000U),
PLLVE(140,     1,     1,     846000000U),
PLLVE(70,     0,     1,     852000000U),
PLLVE(142,     1,     1,     858000000U),
PLLVE(35,     0,     0,     864000000U),
PLLVE(144,     1,     1,     870000000U),
PLLVE(72,     0,     1,     876000000U),
PLLVE(146,     1,     1,     882000000U),
PLLVE(36,     0,     0,     888000000U),
PLLVE(148,     1,     1,     894000000U),
PLLVE(74,     0,     1,     900000000U),
PLLVE(150,     1,     1,     906000000U),
PLLVE(37,     0,     0,     912000000U),
PLLVE(152,     1,     1,     918000000U),
PLLVE(76,     0,     1,     924000000U),
PLLVE(154,     1,     1,     930000000U),
PLLVE(38,     0,     0,     936000000U),
PLLVE(156,     1,     1,     942000000U),
PLLVE(78,     0,     1,     948000000U),
PLLVE(158,     1,     1,     954000000U),
PLLVE(39,     0,     0,     960000000U),
PLLVE(160,     1,     1,     966000000U),
PLLVE(80,     0,     1,     972000000U),
PLLVE(162,     1,     1,     978000000U),
PLLVE(40,     0,     0,     984000000U),
PLLVE(164,     1,     1,     990000000U),
PLLVE(82,     0,     1,     996000000U),
};

/* PLLDE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllde_tbl[] = {
PLLDE(54,     1,     1,     330000000U),
PLLDE(58,     1,     1,     354000000U),
PLLDE(59,     1,     1,     360000000U),
PLLDE(60,     1,     1,     366000000U),
PLLDE(30,     0,     1,     372000000U),
PLLDE(62,     1,     1,     378000000U),
PLLDE(31,     0,     1,     384000000U),
PLLDE(64,     1,     1,     390000000U),
PLLDE(32,     0,     1,     396000000U),
PLLDE(66,     1,     1,     402000000U),
PLLDE(33,     0,     1,     408000000U),
PLLDE(68,     1,     1,     414000000U),
PLLDE(34,     0,     1,     420000000U),
PLLDE(70,     1,     1,     426000000U),
PLLDE(35,     0,     1,     432000000U),
PLLDE(72,     1,     1,     438000000U),
PLLDE(36,     0,     1,     444000000U),
PLLDE(74,     1,     1,     450000000U),
PLLDE(18,     0,     0,     456000000U),
PLLDE(76,     1,     1,     462000000U),
PLLDE(38,     0,     1,     468000000U),
PLLDE(78,     1,     1,     474000000U),
PLLDE(19,     0,     0,     480000000U),
PLLDE(80,     1,     1,     486000000U),
PLLDE(40,     0,     1,     492000000U),
PLLDE(82,     1,     1,     498000000U),
PLLDE(20,     0,     0,     504000000U),
PLLDE(84,     1,     1,     510000000U),
PLLDE(42,     0,     1,     516000000U),
PLLDE(86,     1,     1,     522000000U),
PLLDE(21,     0,     0,     528000000U),
PLLDE(88,     1,     1,     534000000U),
PLLDE(44,     0,     1,     540000000U),
PLLDE(90,     1,     1,     546000000U),
PLLDE(22,     0,     0,     552000000U),
PLLDE(92,     1,     1,     558000000U),
PLLDE(46,     0,     1,     564000000U),
PLLDE(94,     1,     1,     570000000U),
PLLDE(23,     0,     0,     576000000U),
PLLDE(96,     1,     1,     582000000U),
PLLDE(48,     0,     1,     588000000U),
PLLDE(98,     1,     1,     594000000U),
PLLDE(24,     0,     0,     600000000U),
PLLDE(100,     1,     1,     606000000U),
PLLDE(50,     0,     1,     612000000U),
PLLDE(102,     1,     1,     618000000U),
PLLDE(25,     0,     0,     624000000U),
PLLDE(104,     1,     1,     630000000U),
PLLDE(52,     0,     1,     636000000U),
PLLDE(106,     1,     1,     642000000U),
PLLDE(26,     0,     0,     648000000U),
PLLDE(108,     1,     1,     654000000U),
PLLDE(54,     0,     1,     660000000U),
PLLDE(110,     1,     1,     666000000U),
PLLDE(27,     0,     0,     672000000U),
PLLDE(112,     1,     1,     678000000U),
PLLDE(56,     0,     1,     684000000U),
PLLDE(114,     1,     1,     690000000U),
PLLDE(28,     0,     0,     696000000U),
PLLDE(116,     1,     1,     702000000U),
PLLDE(58,     0,     1,     708000000U),
PLLDE(118,     1,     1,     714000000U),
PLLDE(29,     0,     0,     720000000U),
PLLDE(120,     1,     1,     726000000U),
PLLDE(60,     0,     1,     732000000U),
PLLDE(122,     1,     1,     738000000U),
PLLDE(30,     0,     0,     744000000U),
PLLDE(124,     1,     1,     750000000U),
PLLDE(62,     0,     1,     756000000U),
PLLDE(126,     1,     1,     762000000U),
PLLDE(31,     0,     0,     768000000U),
PLLDE(128,     1,     1,     774000000U),
PLLDE(64,     0,     1,     780000000U),
PLLDE(130,     1,     1,     786000000U),
PLLDE(32,     0,     0,     792000000U),
PLLDE(132,     1,     1,     798000000U),
PLLDE(66,     0,     1,     804000000U),
PLLDE(134,     1,     1,     810000000U),
PLLDE(33,     0,     0,     816000000U),
PLLDE(136,     1,     1,     822000000U),
PLLDE(68,     0,     1,     828000000U),
PLLDE(138,     1,     1,     834000000U),
PLLDE(34,     0,     0,     840000000U),
PLLDE(140,     1,     1,     846000000U),
PLLDE(70,     0,     1,     852000000U),
PLLDE(142,     1,     1,     858000000U),
PLLDE(35,     0,     0,     864000000U),
PLLDE(144,     1,     1,     870000000U),
PLLDE(72,     0,     1,     876000000U),
PLLDE(146,     1,     1,     882000000U),
PLLDE(36,     0,     0,     888000000U),
PLLDE(148,     1,     1,     894000000U),
PLLDE(74,     0,     1,     900000000U),
PLLDE(150,     1,     1,     906000000U),
PLLDE(37,     0,     0,     912000000U),
PLLDE(152,     1,     1,     918000000U),
PLLDE(76,     0,     1,     924000000U),
PLLDE(154,     1,     1,     930000000U),
PLLDE(38,     0,     0,     936000000U),
PLLDE(156,     1,     1,     942000000U),
PLLDE(78,     0,     1,     948000000U),
PLLDE(158,     1,     1,     954000000U),
PLLDE(39,     0,     0,     960000000U),
PLLDE(80,     0,     1,     972000000U),
PLLDE(40,     0,     0,     984000000U),
PLLDE(82,     0,     1,     996000000U),
};

/* PLLISP(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllisp_tbl[] = {
PLLISP(24,     0,     1,     300000000U),
PLLISP(50,     1,     1,     306000000U),
PLLISP(51,     1,     1,     312000000U),
PLLISP(26,     0,     1,     324000000U),
PLLISP(54,     1,     1,     330000000U),
PLLISP(27,     0,     1,     336000000U),
PLLISP(56,     1,     1,     342000000U),
PLLISP(28,     0,     1,     348000000U),
PLLISP(58,     1,     1,     354000000U),
PLLISP(29,     0,     1,     360000000U),
PLLISP(60,     1,     1,     366000000U),
PLLISP(30,     0,     1,     372000000U),
PLLISP(62,     1,     1,     378000000U),
PLLISP(31,     0,     1,     384000000U),
PLLISP(64,     1,     1,     390000000U),
PLLISP(32,     0,     1,     396000000U),
PLLISP(66,     1,     1,     402000000U),
PLLISP(16,     0,     0,     408000000U),
PLLISP(68,     1,     1,     414000000U),
PLLISP(34,     0,     1,     420000000U),
PLLISP(70,     1,     1,     426000000U),
PLLISP(17,     0,     0,     432000000U),
PLLISP(72,     1,     1,     438000000U),
PLLISP(36,     0,     1,     444000000U),
PLLISP(74,     1,     1,     450000000U),
PLLISP(18,     0,     0,     456000000U),
PLLISP(76,     1,     1,     462000000U),
PLLISP(38,     0,     1,     468000000U),
PLLISP(78,     1,     1,     474000000U),
PLLISP(19,     0,     0,     480000000U),
PLLISP(80,     1,     1,     486000000U),
PLLISP(40,     0,     1,     492000000U),
PLLISP(82,     1,     1,     498000000U),
PLLISP(20,     0,     0,     504000000U),
PLLISP(84,     1,     1,     510000000U),
PLLISP(42,     0,     1,     516000000U),
PLLISP(86,     1,     1,     522000000U),
PLLISP(21,     0,     0,     528000000U),
PLLISP(88,     1,     1,     534000000U),
PLLISP(44,     0,     1,     540000000U),
PLLISP(90,     1,     1,     546000000U),
PLLISP(22,     0,     0,     552000000U),
PLLISP(92,     1,     1,     558000000U),
PLLISP(46,     0,     1,     564000000U),
PLLISP(94,     1,     1,     570000000U),
PLLISP(23,     0,     0,     576000000U),
PLLISP(96,     1,     1,     582000000U),
PLLISP(48,     0,     1,     588000000U),
PLLISP(98,     1,     1,     594000000U),
PLLISP(24,     0,     0,     600000000U),
PLLISP(100,     1,     1,     606000000U),
PLLISP(50,     0,     1,     612000000U),
PLLISP(102,     1,     1,     618000000U),
PLLISP(25,     0,     0,     624000000U),
PLLISP(104,     1,     1,     630000000U),
PLLISP(52,     0,     1,     636000000U),
PLLISP(106,     1,     1,     642000000U),
PLLISP(26,     0,     0,     648000000U),
PLLISP(108,     1,     1,     654000000U),
PLLISP(54,     0,     1,     660000000U),
PLLISP(110,     1,     1,     666000000U),
PLLISP(27,     0,     0,     672000000U),
PLLISP(112,     1,     1,     678000000U),
PLLISP(56,     0,     1,     684000000U),
PLLISP(114,     1,     1,     690000000U),
PLLISP(28,     0,     0,     696000000U),
PLLISP(116,     1,     1,     702000000U),
PLLISP(58,     0,     1,     708000000U),
PLLISP(118,     1,     1,     714000000U),
PLLISP(29,     0,     0,     720000000U),
PLLISP(120,     1,     1,     726000000U),
PLLISP(60,     0,     1,     732000000U),
PLLISP(122,     1,     1,     738000000U),
PLLISP(30,     0,     0,     744000000U),
PLLISP(124,     1,     1,     750000000U),
PLLISP(62,     0,     1,     756000000U),
PLLISP(126,     1,     1,     762000000U),
PLLISP(31,     0,     0,     768000000U),
PLLISP(128,     1,     1,     774000000U),
PLLISP(64,     0,     1,     780000000U),
PLLISP(130,     1,     1,     786000000U),
PLLISP(32,     0,     0,     792000000U),
PLLISP(132,     1,     1,     798000000U),
PLLISP(66,     0,     1,     804000000U),
PLLISP(134,     1,     1,     810000000U),
PLLISP(33,     0,     0,     816000000U),
PLLISP(136,     1,     1,     822000000U),
PLLISP(68,     0,     1,     828000000U),
PLLISP(138,     1,     1,     834000000U),
PLLISP(34,     0,     0,     840000000U),
PLLISP(140,     1,     1,     846000000U),
PLLISP(70,     0,     1,     852000000U),
PLLISP(142,     1,     1,     858000000U),
PLLISP(35,     0,     0,     864000000U),
PLLISP(144,     1,     1,     870000000U),
PLLISP(72,     0,     1,     876000000U),
PLLISP(146,     1,     1,     882000000U),
PLLISP(36,     0,     0,     888000000U),
PLLISP(148,     1,     1,     894000000U),
PLLISP(74,     0,     1,     900000000U),
PLLISP(150,     1,     1,     906000000U),
PLLISP(37,     0,     0,     912000000U),
PLLISP(152,     1,     1,     918000000U),
PLLISP(76,     0,     1,     924000000U),
PLLISP(154,     1,     1,     930000000U),
PLLISP(38,     0,     0,     936000000U),
PLLISP(156,     1,     1,     942000000U),
PLLISP(78,     0,     1,     948000000U),
PLLISP(158,     1,     1,     954000000U),
PLLISP(39,     0,     0,     960000000U),
PLLISP(160,     1,     1,     966000000U),
PLLISP(80,     0,     1,     972000000U),
PLLISP(162,     1,     1,     978000000U),
PLLISP(40,     0,     0,     984000000U),
PLLISP(164,     1,     1,     990000000U),
PLLISP(82,     0,     1,     996000000U),
};

/* PLLAUDIO(n, p, d1, d2, freq)	F_N8X8_P16X6_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllaudio_tbl[] = {
PLLAUDIO(11,    0,    0,    0,    288000000U),
};

/* PLLEVE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_plleve_tbl[] = {
PLLEVE(50,     1,     1,     306000000U),
PLLEVE(51,     1,     1,     312000000U),
PLLEVE(52,     1,     1,     318000000U),
PLLEVE(53,     1,     1,     324000000U),
PLLEVE(54,     1,     1,     330000000U),
PLLEVE(28,     0,     1,     348000000U),
PLLEVE(58,     1,     1,     354000000U),
PLLEVE(29,     0,     1,     360000000U),
PLLEVE(60,     1,     1,     366000000U),
PLLEVE(61,     1,     1,     372000000U),
PLLEVE(62,     1,     1,     378000000U),
PLLEVE(31,     0,     1,     384000000U),
PLLEVE(64,     1,     1,     390000000U),
PLLEVE(32,     0,     1,     396000000U),
PLLEVE(66,     1,     1,     402000000U),
PLLEVE(33,     0,     1,     408000000U),
PLLEVE(68,     1,     1,     414000000U),
PLLEVE(34,     0,     1,     420000000U),
PLLEVE(70,     1,     1,     426000000U),
PLLEVE(17,     0,     0,     432000000U),
PLLEVE(72,     1,     1,     438000000U),
PLLEVE(36,     0,     1,     444000000U),
PLLEVE(74,     1,     1,     450000000U),
PLLEVE(18,     0,     0,     456000000U),
PLLEVE(76,     1,     1,     462000000U),
PLLEVE(38,     0,     1,     468000000U),
PLLEVE(78,     1,     1,     474000000U),
PLLEVE(19,     0,     0,     480000000U),
PLLEVE(80,     1,     1,     486000000U),
PLLEVE(40,     0,     1,     492000000U),
PLLEVE(82,     1,     1,     498000000U),
PLLEVE(20,     0,     0,     504000000U),
PLLEVE(84,     1,     1,     510000000U),
PLLEVE(42,     0,     1,     516000000U),
PLLEVE(86,     1,     1,     522000000U),
PLLEVE(21,     0,     0,     528000000U),
PLLEVE(88,     1,     1,     534000000U),
PLLEVE(44,     0,     1,     540000000U),
PLLEVE(90,     1,     1,     546000000U),
PLLEVE(22,     0,     0,     552000000U),
PLLEVE(92,     1,     1,     558000000U),
PLLEVE(46,     0,     1,     564000000U),
PLLEVE(94,     1,     1,     570000000U),
PLLEVE(23,     0,     0,     576000000U),
PLLEVE(96,     1,     1,     582000000U),
PLLEVE(48,     0,     1,     588000000U),
PLLEVE(98,     1,     1,     594000000U),
PLLEVE(24,     0,     0,     600000000U),
PLLEVE(100,     1,     1,     606000000U),
PLLEVE(50,     0,     1,     612000000U),
PLLEVE(102,     1,     1,     618000000U),
PLLEVE(25,     0,     0,     624000000U),
PLLEVE(104,     1,     1,     630000000U),
PLLEVE(52,     0,     1,     636000000U),
PLLEVE(106,     1,     1,     642000000U),
PLLEVE(26,     0,     0,     648000000U),
PLLEVE(108,     1,     1,     654000000U),
PLLEVE(54,     0,     1,     660000000U),
PLLEVE(110,     1,     1,     666000000U),
PLLEVE(27,     0,     0,     672000000U),
PLLEVE(112,     1,     1,     678000000U),
PLLEVE(56,     0,     1,     684000000U),
PLLEVE(114,     1,     1,     690000000U),
PLLEVE(28,     0,     0,     696000000U),
PLLEVE(116,     1,     1,     702000000U),
PLLEVE(58,     0,     1,     708000000U),
PLLEVE(118,     1,     1,     714000000U),
PLLEVE(29,     0,     0,     720000000U),
PLLEVE(120,     1,     1,     726000000U),
PLLEVE(60,     0,     1,     732000000U),
PLLEVE(122,     1,     1,     738000000U),
PLLEVE(30,     0,     0,     744000000U),
PLLEVE(124,     1,     1,     750000000U),
PLLEVE(62,     0,     1,     756000000U),
PLLEVE(126,     1,     1,     762000000U),
PLLEVE(31,     0,     0,     768000000U),
PLLEVE(128,     1,     1,     774000000U),
PLLEVE(64,     0,     1,     780000000U),
PLLEVE(130,     1,     1,     786000000U),
PLLEVE(32,     0,     0,     792000000U),
PLLEVE(132,     1,     1,     798000000U),
PLLEVE(66,     0,     1,     804000000U),
PLLEVE(134,     1,     1,     810000000U),
PLLEVE(33,     0,     0,     816000000U),
PLLEVE(136,     1,     1,     822000000U),
PLLEVE(68,     0,     1,     828000000U),
PLLEVE(138,     1,     1,     834000000U),
PLLEVE(34,     0,     0,     840000000U),
PLLEVE(140,     1,     1,     846000000U),
PLLEVE(70,     0,     1,     852000000U),
PLLEVE(142,     1,     1,     858000000U),
PLLEVE(35,     0,     0,     864000000U),
PLLEVE(144,     1,     1,     870000000U),
PLLEVE(72,     0,     1,     876000000U),
PLLEVE(146,     1,     1,     882000000U),
PLLEVE(36,     0,     0,     888000000U),
PLLEVE(148,     1,     1,     894000000U),
PLLEVE(74,     0,     1,     900000000U),
PLLEVE(150,     1,     1,     906000000U),
PLLEVE(37,     0,     0,     912000000U),
PLLEVE(152,     1,     1,     918000000U),
PLLEVE(76,     0,     1,     924000000U),
PLLEVE(154,     1,     1,     930000000U),
PLLEVE(38,     0,     0,     936000000U),
PLLEVE(156,     1,     1,     942000000U),
PLLEVE(78,     0,     1,     948000000U),
PLLEVE(158,     1,     1,     954000000U),
PLLEVE(39,     0,     0,     960000000U),
PLLEVE(160,     1,     1,     966000000U),
PLLEVE(80,     0,     1,     972000000U),
PLLEVE(162,     1,     1,     978000000U),
PLLEVE(40,     0,     0,     984000000U),
PLLEVE(164,     1,     1,     990000000U),
PLLEVE(82,     0,     1,     996000000U),
};

/* PLLCVE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllcve_tbl[] = {
PLLCVE(21,     0,     1,     264000000U),
PLLCVE(45,     1,     1,     276000000U),
PLLCVE(46,     1,     1,     282000000U),
PLLCVE(23,     0,     1,     288000000U),
PLLCVE(48,     1,     1,     294000000U),
PLLCVE(24,     0,     1,     300000000U),
PLLCVE(50,     1,     1,     306000000U),
PLLCVE(25,     0,     1,     312000000U),
PLLCVE(52,     1,     1,     318000000U),
PLLCVE(26,     0,     1,     324000000U),
PLLCVE(54,     1,     1,     330000000U),
PLLCVE(27,     0,     1,     336000000U),
PLLCVE(56,     1,     1,     342000000U),
PLLCVE(28,     0,     1,     348000000U),
PLLCVE(58,     1,     1,     354000000U),
PLLCVE(29,     0,     1,     360000000U),
PLLCVE(60,     1,     1,     366000000U),
PLLCVE(30,     0,     1,     372000000U),
PLLCVE(62,     1,     1,     378000000U),
PLLCVE(31,     0,     1,     384000000U),
PLLCVE(64,     1,     1,     390000000U),
PLLCVE(32,     0,     1,     396000000U),
PLLCVE(66,     1,     1,     402000000U),
PLLCVE(16,     0,     0,     408000000U),
PLLCVE(68,     1,     1,     414000000U),
PLLCVE(34,     0,     1,     420000000U),
PLLCVE(70,     1,     1,     426000000U),
PLLCVE(17,     0,     0,     432000000U),
PLLCVE(72,     1,     1,     438000000U),
PLLCVE(36,     0,     1,     444000000U),
PLLCVE(74,     1,     1,     450000000U),
PLLCVE(18,     0,     0,     456000000U),
PLLCVE(76,     1,     1,     462000000U),
PLLCVE(38,     0,     1,     468000000U),
PLLCVE(78,     1,     1,     474000000U),
PLLCVE(19,     0,     0,     480000000U),
PLLCVE(80,     1,     1,     486000000U),
PLLCVE(40,     0,     1,     492000000U),
PLLCVE(82,     1,     1,     498000000U),
PLLCVE(20,     0,     0,     504000000U),
PLLCVE(84,     1,     1,     510000000U),
PLLCVE(42,     0,     1,     516000000U),
PLLCVE(86,     1,     1,     522000000U),
PLLCVE(21,     0,     0,     528000000U),
PLLCVE(88,     1,     1,     534000000U),
PLLCVE(44,     0,     1,     540000000U),
PLLCVE(90,     1,     1,     546000000U),
PLLCVE(22,     0,     0,     552000000U),
PLLCVE(92,     1,     1,     558000000U),
PLLCVE(46,     0,     1,     564000000U),
PLLCVE(94,     1,     1,     570000000U),
PLLCVE(23,     0,     0,     576000000U),
PLLCVE(96,     1,     1,     582000000U),
PLLCVE(48,     0,     1,     588000000U),
PLLCVE(98,     1,     1,     594000000U),
PLLCVE(24,     0,     0,     600000000U),
PLLCVE(100,     1,     1,     606000000U),
PLLCVE(50,     0,     1,     612000000U),
PLLCVE(102,     1,     1,     618000000U),
PLLCVE(25,     0,     0,     624000000U),
PLLCVE(104,     1,     1,     630000000U),
PLLCVE(52,     0,     1,     636000000U),
PLLCVE(106,     1,     1,     642000000U),
PLLCVE(26,     0,     0,     648000000U),
PLLCVE(108,     1,     1,     654000000U),
PLLCVE(54,     0,     1,     660000000U),
PLLCVE(110,     1,     1,     666000000U),
PLLCVE(27,     0,     0,     672000000U),
PLLCVE(112,     1,     1,     678000000U),
PLLCVE(56,     0,     1,     684000000U),
PLLCVE(114,     1,     1,     690000000U),
PLLCVE(28,     0,     0,     696000000U),
PLLCVE(116,     1,     1,     702000000U),
PLLCVE(58,     0,     1,     708000000U),
PLLCVE(118,     1,     1,     714000000U),
PLLCVE(29,     0,     0,     720000000U),
PLLCVE(120,     1,     1,     726000000U),
PLLCVE(60,     0,     1,     732000000U),
PLLCVE(122,     1,     1,     738000000U),
PLLCVE(30,     0,     0,     744000000U),
PLLCVE(124,     1,     1,     750000000U),
PLLCVE(62,     0,     1,     756000000U),
PLLCVE(126,     1,     1,     762000000U),
PLLCVE(31,     0,     0,     768000000U),
PLLCVE(128,     1,     1,     774000000U),
PLLCVE(64,     0,     1,     780000000U),
PLLCVE(130,     1,     1,     786000000U),
PLLCVE(32,     0,     0,     792000000U),
PLLCVE(132,     1,     1,     798000000U),
PLLCVE(66,     0,     1,     804000000U),
PLLCVE(134,     1,     1,     810000000U),
PLLCVE(33,     0,     0,     816000000U),
PLLCVE(136,     1,     1,     822000000U),
PLLCVE(68,     0,     1,     828000000U),
PLLCVE(138,     1,     1,     834000000U),
PLLCVE(34,     0,     0,     840000000U),
PLLCVE(140,     1,     1,     846000000U),
PLLCVE(70,     0,     1,     852000000U),
PLLCVE(142,     1,     1,     858000000U),
PLLCVE(35,     0,     0,     864000000U),
PLLCVE(144,     1,     1,     870000000U),
PLLCVE(72,     0,     1,     876000000U),
PLLCVE(146,     1,     1,     882000000U),
PLLCVE(36,     0,     0,     888000000U),
PLLCVE(148,     1,     1,     894000000U),
PLLCVE(74,     0,     1,     900000000U),
PLLCVE(150,     1,     1,     906000000U),
PLLCVE(37,     0,     0,     912000000U),
PLLCVE(152,     1,     1,     918000000U),
PLLCVE(76,     0,     1,     924000000U),
PLLCVE(154,     1,     1,     930000000U),
PLLCVE(38,     0,     0,     936000000U),
PLLCVE(156,     1,     1,     942000000U),
PLLCVE(78,     0,     1,     948000000U),
PLLCVE(158,     1,     1,     954000000U),
PLLCVE(39,     0,     0,     960000000U),
PLLCVE(160,     1,     1,     966000000U),
PLLCVE(80,     0,     1,     972000000U),
PLLCVE(162,     1,     1,     978000000U),
PLLCVE(40,     0,     0,     984000000U),
PLLCVE(164,     1,     1,     990000000U),
PLLCVE(82,     0,     1,     996000000U),
};

/* PLLISE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllise_tbl[] = {
PLLISE(23,     0,     1,     288000000U),
PLLISE(48,     1,     1,     294000000U),
PLLISE(49,     1,     1,     300000000U),
PLLISE(50,     1,     1,     306000000U),
PLLISE(25,     0,     1,     312000000U),
PLLISE(52,     1,     1,     318000000U),
PLLISE(26,     0,     1,     324000000U),
PLLISE(54,     1,     1,     330000000U),
PLLISE(27,     0,     1,     336000000U),
PLLISE(56,     1,     1,     342000000U),
PLLISE(28,     0,     1,     348000000U),
PLLISE(58,     1,     1,     354000000U),
PLLISE(29,     0,     1,     360000000U),
PLLISE(60,     1,     1,     366000000U),
PLLISE(30,     0,     1,     372000000U),
PLLISE(62,     1,     1,     378000000U),
PLLISE(31,     0,     1,     384000000U),
PLLISE(64,     1,     1,     390000000U),
PLLISE(32,     0,     1,     396000000U),
PLLISE(66,     1,     1,     402000000U),
PLLISE(33,     0,     1,     408000000U),
PLLISE(68,     1,     1,     414000000U),
PLLISE(34,     0,     1,     420000000U),
PLLISE(70,     1,     1,     426000000U),
PLLISE(35,     0,     1,     432000000U),
PLLISE(72,     1,     1,     438000000U),
PLLISE(36,     0,     1,     444000000U),
PLLISE(74,     1,     1,     450000000U),
PLLISE(18,     0,     0,     456000000U),
PLLISE(76,     1,     1,     462000000U),
PLLISE(38,     0,     1,     468000000U),
PLLISE(78,     1,     1,     474000000U),
PLLISE(19,     0,     0,     480000000U),
PLLISE(80,     1,     1,     486000000U),
PLLISE(40,     0,     1,     492000000U),
PLLISE(82,     1,     1,     498000000U),
PLLISE(20,     0,     0,     504000000U),
PLLISE(84,     1,     1,     510000000U),
PLLISE(42,     0,     1,     516000000U),
PLLISE(86,     1,     1,     522000000U),
PLLISE(21,     0,     0,     528000000U),
PLLISE(88,     1,     1,     534000000U),
PLLISE(44,     0,     1,     540000000U),
PLLISE(90,     1,     1,     546000000U),
PLLISE(22,     0,     0,     552000000U),
PLLISE(92,     1,     1,     558000000U),
PLLISE(46,     0,     1,     564000000U),
PLLISE(94,     1,     1,     570000000U),
PLLISE(23,     0,     0,     576000000U),
PLLISE(96,     1,     1,     582000000U),
PLLISE(48,     0,     1,     588000000U),
PLLISE(98,     1,     1,     594000000U),
PLLISE(24,     0,     0,     600000000U),
PLLISE(100,     1,     1,     606000000U),
PLLISE(50,     0,     1,     612000000U),
PLLISE(102,     1,     1,     618000000U),
PLLISE(25,     0,     0,     624000000U),
PLLISE(104,     1,     1,     630000000U),
PLLISE(52,     0,     1,     636000000U),
PLLISE(106,     1,     1,     642000000U),
PLLISE(26,     0,     0,     648000000U),
PLLISE(108,     1,     1,     654000000U),
PLLISE(54,     0,     1,     660000000U),
PLLISE(110,     1,     1,     666000000U),
PLLISE(27,     0,     0,     672000000U),
PLLISE(112,     1,     1,     678000000U),
PLLISE(56,     0,     1,     684000000U),
PLLISE(114,     1,     1,     690000000U),
PLLISE(28,     0,     0,     696000000U),
PLLISE(116,     1,     1,     702000000U),
PLLISE(58,     0,     1,     708000000U),
PLLISE(118,     1,     1,     714000000U),
PLLISE(29,     0,     0,     720000000U),
PLLISE(120,     1,     1,     726000000U),
PLLISE(60,     0,     1,     732000000U),
PLLISE(122,     1,     1,     738000000U),
PLLISE(30,     0,     0,     744000000U),
PLLISE(124,     1,     1,     750000000U),
PLLISE(62,     0,     1,     756000000U),
PLLISE(126,     1,     1,     762000000U),
PLLISE(31,     0,     0,     768000000U),
PLLISE(128,     1,     1,     774000000U),
PLLISE(64,     0,     1,     780000000U),
PLLISE(130,     1,     1,     786000000U),
PLLISE(32,     0,     0,     792000000U),
PLLISE(132,     1,     1,     798000000U),
PLLISE(66,     0,     1,     804000000U),
PLLISE(134,     1,     1,     810000000U),
PLLISE(33,     0,     0,     816000000U),
PLLISE(136,     1,     1,     822000000U),
PLLISE(68,     0,     1,     828000000U),
PLLISE(138,     1,     1,     834000000U),
PLLISE(34,     0,     0,     840000000U),
PLLISE(140,     1,     1,     846000000U),
PLLISE(70,     0,     1,     852000000U),
PLLISE(142,     1,     1,     858000000U),
PLLISE(35,     0,     0,     864000000U),
PLLISE(144,     1,     1,     870000000U),
PLLISE(72,     0,     1,     876000000U),
PLLISE(146,     1,     1,     882000000U),
PLLISE(36,     0,     0,     888000000U),
PLLISE(148,     1,     1,     894000000U),
PLLISE(74,     0,     1,     900000000U),
PLLISE(150,     1,     1,     906000000U),
PLLISE(37,     0,     0,     912000000U),
PLLISE(152,     1,     1,     918000000U),
PLLISE(76,     0,     1,     924000000U),
PLLISE(154,     1,     1,     930000000U),
PLLISE(38,     0,     0,     936000000U),
PLLISE(156,     1,     1,     942000000U),
PLLISE(78,     0,     1,     948000000U),
PLLISE(158,     1,     1,     954000000U),
PLLISE(39,     0,     0,     960000000U),
PLLISE(160,     1,     1,     966000000U),
PLLISE(80,     0,     1,     972000000U),
PLLISE(162,     1,     1,     978000000U),
PLLISE(40,     0,     0,     984000000U),
PLLISE(164,     1,     1,     990000000U),
PLLISE(82,     0,     1,     996000000U),
};

static unsigned int pllcpu_max, pllddr0_max, pllddr1_max, pllperiph0_max,
		pllperiph1_max, pllvideo0_max, pllve_max, pllde_max, pllisp_max,
		pllaudio_max, plleve_max, pllcve_max, pllise_max;

#define PLL_MAX_ASSIGN(name) (pll##name##_max = \
	factor_pll##name##_tbl[ARRAY_SIZE(factor_pll##name##_tbl)-1].freq)

void sunxi_clk_factor_initlimits(void)
{
	PLL_MAX_ASSIGN(cpu);
	PLL_MAX_ASSIGN(ddr0);
	PLL_MAX_ASSIGN(ddr1);
	PLL_MAX_ASSIGN(periph0);
	PLL_MAX_ASSIGN(periph1);
	PLL_MAX_ASSIGN(video0);
	PLL_MAX_ASSIGN(ve);
	PLL_MAX_ASSIGN(de);
	PLL_MAX_ASSIGN(isp);
	PLL_MAX_ASSIGN(audio);
	PLL_MAX_ASSIGN(eve);
	PLL_MAX_ASSIGN(cve);
	PLL_MAX_ASSIGN(ise);
}
